﻿@model KL.Store.Web.Models.VariantListModel
@using KL.Store.Core
@{
    Layout = null;
}
@if (Model.ProductList.Count() > 1)
{
    <select name="selectVariantProduct">
        @foreach (var vp in Model.ProductList)
        {
            <option value="@vp.ProductId"@{if (vp.ProductId == Model.ProductId)
                                           {<text> selected="selected"</text>}}>@(vp.ProductName + (!string.IsNullOrEmpty(vp.Model) ? " - " + vp.Model : ""))</option>

        }
    </select>
    <script>
        $('select[name=selectVariantProduct]').change(function ()
        {
            var selectedPage = $(this).find(':selected').val();
            window.location.href = "/ProductManage/Edit/" + selectedPage + "?toEdit=@(Model.ToEdit)";
        });
    </script>
}